#include "stdlib.h"
#include "string.h"
#include <hidef.h> /* for EnableInterrupts macro */
#include "Headers/derivative.h" /* include peripheral declarations */
#include "Headers/define.h"
#include "Headers/GPIO.h"
#include "Headers/SPI.h"
#include "Headers/ICG.h"
#include "Headers/micelaneous.h"
#include "Headers/RF.h"
#include "Headers/time.h"
#include "Headers/ADC.h"
#include "Headers/regadera.h"
void empezar(void){
char *command_rx, *command_rf, *error;
int x = 0;
command_rf = malloc(125);
command_rx = malloc(125);
  if(!sw1){
    ld1 = 0;
    error = strcpy(command_rf, "go");
    while(strcmp(command_rx,"") == 0 && x < 500){
       if(!TX_pkt_rf(command_rf)){
        if(!RX_pkt_rf(command_rx)){
         if(strcmp(command_rx, "ok") != 0) *command_rx = 0; 
        }else *command_rx = 0;
       }else *command_rx = 0;
       __RESET_WATCHDOG();
       x++;
    }
  }else ld1 = 1;
  free(command_rf);
  free(command_rx);
}